from PySide6.QtWidgets import QWidget, QLabel, QVBoxLayout

from common.equipment.weapon import Weapon
from gui.reference import html_table


class EquipmentDetail(QWidget):
    def __init__(self, equip: Weapon):
        super().__init__()
        self.equip = equip
        self.setWindowTitle('详情')

        layout = QVBoxLayout(self)
        label = QLabel(self)
        label.setWordWrap(True)

        label.setText(html_table(equip.dialog_content(), equip.name))
        # label.linkActivated.connect(self.on_link_activated)
        layout.addWidget(label)

    # def on_link_activated(self, link: str):
    #     if link.startswith('action:'):
    #         action = link[7:]
    #         print(action)
